package cn.itcast.controller;

import cn.itcast.pojo.Weather;
import cn.itcast.service.WeatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/weather")
public class WeatherController {

    @Autowired
    private WeatherService weatherService;

    @GetMapping("/getCityWeatherInfo/{cityName}")
    public List<Weather>  getCityWeatherInfo(@PathVariable("cityName") String cityName) {
        return weatherService.getCityWeatherInfo(cityName);
    }
}
